/*
 * XMLLevel.java
 *
 *  Copyright (c) 2008 Corey Oliver and Anshul Kumaria
 *
 *  This file is part of Balls of Fury.
 *
 *  Balls of Fury is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Balls of Fury is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 *
 */

/*
 * EDIT:  03/13/2008 - This is an example of how an edit performed to the class 
 * would appear.
 */

package ballsoffury.playground.model;

import java.io.IOException;
import java.util.Vector;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

import com.sun.org.apache.xerces.internal.parsers.SAXParser;

/**
 * <code>XMLLevel</code> allows for management of the game. Various methods 
 * are included in this class to show various screens, alter preferences,  
 * and exit the application.
 *
 * @author Corey Oliver
 * @version $Revision:$ $Date:$
 */
public class XMLLevel {

	private LevelHandler levelHandler;

	public XMLLevel( String fileName )
	{
        try {
            XMLReader xmlReader = new SAXParser();
            levelHandler = new LevelHandler();
			xmlReader.setContentHandler(levelHandler);
            InputSource is = new InputSource(new java.io.FileInputStream(fileName));
            xmlReader.parse(is);
        } catch (IOException ex) {
            System.exit(-1);
        } catch (SAXException ex) {
            System.exit(-1);
        }
	}

	public int getWidth() {
		return levelHandler.width;
	}

	public int getHeight() {
		return levelHandler.height;
	}

	public int getDepth() {
		return levelHandler.depth;
	}

	public Vector<String> getLines() {
		return levelHandler.lines;
	}
}
